package com.acarter.scenemonitor.propertydescriptor.enums;
/**
 * <p>Title</p>
 * 
 * <p>Description: </p>
 *
 * <p>Copyright (c) 2007</p>
 *
 * @author Andrew Carter
 * @version 
 */


/**
 * Enumerates the permissible alpha destination functions.
 * 
 * @author Andrew Carter
 */
public enum E_DestinationFunction {
	
    /** The destination value of the blend function is all zeros. */
    DB_ZERO("DB_ZERO", 0),
    
    /** The destination value of the blend function is all ones. */
    DB_ONE("DB_ONE", 1),
    
    /** The destination value of the blend function is the source color. */
    DB_SRC_COLOR("DB_SRC_COLOR", 2),
    
    /** The destination value of the blend function is 1 - the source color. */
    DB_ONE_MINUS_SRC_COLOR("DB_ONE_MINUS_SRC_COLOR", 3),
    
    /** The destination value of the blend function is the source alpha value. */
    DB_SRC_ALPHA("DB_SRC_ALPHA", 4),
    
    /** The destination value of the blend function is 1 - the source alpha value. */
    DB_ONE_MINUS_SRC_ALPHA("DB_ONE_MINUS_SRC_ALPHA", 5),
    
    /** The destination value of the blend function is the destination alpha value. */
    DB_DST_ALPHA("DB_DST_ALPHA", 6),
    
    /** The destination value of the blend function is 1 - the destination alpha value. */
    DB_ONE_MINUS_DST_ALPHA("DB_ONE_MINUS_DST_ALPHA", 7);

	/** String representation of the enum value */
	private String name;

	/** Integer value of the enum value */
	private int value;

	/**
	 * Private constructor.
	 * 
	 * @param value
	 *            String literal of the enum
	 */
	private E_DestinationFunction(String name, int value) {

		this.name = name;
		this.value = value;
	}

	/**
	 * Returns the enum constant matching the name string.
	 * 
	 * @param name
	 *            string value of enum constant
	 * @return matching enum constant or null
	 */
	public static E_DestinationFunction getConstant(String name) {

		for (E_DestinationFunction constant : E_DestinationFunction.values()) {

			if (constant.toString().compareToIgnoreCase(name) == 0)
				return constant;
		}

		return null;
	}

	/**
	 * Returns the enum constant matching the type value.
	 * 
	 * @param type
	 *            type value of enum constant
	 * @return matching enum constant or null
	 */
	public static E_DestinationFunction getConstant(int type) {

		for (E_DestinationFunction constant : E_DestinationFunction.values()) {

			if (constant.getType() == type)
				return constant;
		}

		return null;
	}

	/**
	 * Returns the string value of the constant.
	 */
	public String toString() {

		return name;
	}
	
	/**
	 * Returns the integer value of the constant.
	 * @return 
	 */
	public int getType() {
		
		return value;
	}
}
